home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume13 / backups < prev    next >
Encoding:
Internet Message Format  |  1988-01-31  |  31.1 KB

  1. Subject:  v13i065:  Tools to help automate backups
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Scooter Morris <scooter@genie.gene.com>
  7. Posting-number: Volume 13, Issue 65
  8. Archive-name: backups
  9.  
  10.  
  11. This is a little backup utility that to somewhat automate a backup
  12. schedule.  The main advantage that it has is that it will "quietize" the
  13. system before performing the dumps.
  14.  
  15. The program reads a control file, and determines which filesystems to dump
  16. at which level, and when.  It is designed to work with the UCB "dump(8)"
  17. program.
  18.     /r$
  19.  
  20. #! /bin/sh
  21. # This is a shell archive, meaning:
  22. # 1. Remove everything above the #! /bin/sh line.
  23. # 2. Save the resulting text in a file.
  24. # 3. Execute the file with /bin/sh (not csh) to create the files:
  25. #    README Makefile backup.8 backup.c backup.h convdate.c parser.y
  26. #    proclist.c quietize.c restart.c scanner.l shutdown.c ulist.h
  27. #    genie_dates backup_dates
  28. export PATH; PATH=/bin:$PATH
  29. if test -f 'README'
  30. then
  31.     echo shar: will not over-write existing file "'README'"
  32. else
  33. cat << \SHAR_EOF > 'README'
  34.             backup
  35.  
  36. This program should be run set-uid root.  At genentech, we set the
  37. permissions to 4550 with group operator.  Backup was originally a
  38. simple experiment to play around with yacc, it has proven to be
  39. a very useful tool.  Daily backups are normally performed using
  40. the "-m" option, which allows the system to continue running.  Without
  41. this option, all running processes are sent "SIGHUP", any processes
  42. remaining after the SIGHUP are SIGSTOPped for the duration of the
  43. backup.  After backup is complete, a SIGCONT is sent to all of the
  44. stopped processes.
  45.  
  46. Some notes about exclusions and special cases:  
  47.     There is a list of processes to be excluded from either HUP or
  48.     STOP in proclist.c.  In addition, some programs such as daemons,
  49.     etc. require special restarting.  The table for this is in
  50.     proclist.c also.
  51.  
  52.                     10/2/87
  53. SHAR_EOF
  54. fi # end of overwriting check
  55. if test -f 'Makefile'
  56. then
  57.     echo shar: will not over-write existing file "'Makefile'"
  58. else
  59. cat << \SHAR_EOF > 'Makefile'
  60.  
  61. # $Header: Makefile,v 1.3 85/04/05 17:16:57 scooter Exp $
  62. VPATH = .:./RCS
  63. SOURCES = backup.c quietize.c shutdown.c proclist.c restart.c convdate.c \
  64.       parser.y scanner.l
  65.  
  66. OBJECTS = backup.o quietize.o shutdown.o proclist.o restart.o convdate.o \
  67.       y.tab.o
  68. INCLUDES = backup.h ulist.h
  69. CFLAGS = -O -DDEBUG
  70. YFLAGS = -d
  71.  
  72. .SUFFIXES:    .c,v .l,v .y,v
  73.  
  74. backup: $(OBJECTS)
  75.     cc $(CFLAGS) -o backup $(OBJECTS)
  76.  
  77. y.tab.o: y.tab.c lex.yy.c y.tab.h
  78.     cc $(CFLAGS) -c y.tab.c
  79.  
  80. lex.yy.c:scanner.l
  81.     lex scanner.l
  82.  
  83. y.tab.c: parser.y
  84.      yacc $(YFLAGS) parser.y
  85.  
  86. .y,v.y:
  87.     co $<
  88.  
  89. .l,v.l:
  90.     co $<
  91.  
  92. .c,v.o:    
  93.     co $<
  94.     cc $(CFLAGS) -c $<
  95. SHAR_EOF
  96. fi # end of overwriting check
  97. if test -f 'backup.8'
  98. then
  99.     echo shar: will not over-write existing file "'backup.8'"
  100. else
  101. cat << \SHAR_EOF > 'backup.8'
  102. .TH BACKUP 8
  103. .SH NAME
  104. backup \- perform tape backups
  105. .SH SYNOPSIS
  106. .B backup
  107. [ options ] [ date ]
  108. .SH DESCRIPTION
  109. .vs -1p
  110. .I backup
  111. reads the file
  112. .B /etc/backup_dates
  113. and runs
  114. .B dump(8)
  115. to backup the specified filesystems.  If no
  116. .I date
  117. is given, the current date is used.
  118. The 
  119. .I backup_dates
  120. file consists of lines of 6 fields each.  The fields are separated by spaces
  121. of tabs.  The fields specify the day of the week (Sun-Sat), the week of the
  122. month (1-5), the month (Jan-Dec), the dump level to perform (0-9), the
  123. filesystem, and an arbitrary message to be delivered to the operator upon
  124. completion of the dump.  Each of these fields may contain a range or
  125. a comma-separated list, or an asterisk meaning all legal values.
  126. .PP
  127. Options for 
  128. .I backup
  129. are:
  130. .TP
  131. .B  \-m
  132. Run 
  133. .I backup
  134. in multiuser mode.  Usually backup will kill any forground processes
  135. and suspend any background processes so that the filesystems will be
  136. guaranteed to be quiescent.  When run in multiuser mode, no action
  137. is taken to insure that there is no filesystem activity.
  138. .TP
  139. .BI \-b blocksize
  140. Sets the tape blocking factor to
  141. .I blocksize.
  142. The default is 32.
  143. .TP
  144. .BI \-s tapelength
  145. Sets the assumed length of the tape to
  146. .I tapelength.
  147. This defines how many blocks are written to each tape.  The default is 
  148. 2300 feet.
  149. .TP
  150. .BI \-d density
  151. Sets the tape density to
  152. .I density.
  153. This is normally 6250 BPI.
  154. .TP
  155. .BI \-t device
  156. Sets the device to use to
  157. .I device.
  158. This is /dev/rmt9 on our systems which corresponds to the TU78 tape drives
  159. at 6250 BPI.
  160. .TP
  161. .BI \-f file
  162. Causes backup to read the filesystem dump schedule from the file
  163. .I file
  164. instead of from /etc/backup_dates.
  165. .TP
  166. .BI \-w minutes
  167. Sets the warning time to give users when running in single-user mode.
  168. .SH BACKUP_DATES Example
  169. .nf
  170. # Backup schedule for Genie - Genentech, Inc.
  171. # Daily level 9's
  172. Tue-Fri    *    *    9    /va    "/va dump complete"
  173. # Monday dumps - level 1's
  174. Mon    2-5    *    1    /    "root dump complete"
  175. Mon    2,3,4,5    *    1    /va    "/va dump complete"
  176. # Monthly level 0's
  177. Mon    1    *    0    /    "root dump complete"
  178. Mon    1    *    0    /va    "/va dump complete"
  179. .fi
  180. .SH AUTHOR
  181. Scooter Morris - Genentech, Inc.
  182. .SH SEE ALSO
  183. dump(8), shutdown(8), backup_dates(5)
  184. .SH BUGS
  185. SHAR_EOF
  186. fi # end of overwriting check
  187. if test -f 'backup.c'
  188. then
  189.     echo shar: will not over-write existing file "'backup.c'"
  190. else
  191. cat << \SHAR_EOF > 'backup.c'
  192. #ifdef lint
  193. static char rcsid[] = "$Header: backup.c,v 1.9 86/10/20 18:37:34 scooter Exp $";
  194. #endif lint
  195. /*
  196.  * backup - a program to control daily dumps
  197.  *
  198.  * This program has been written to control the daily dumping
  199.  * of all of the system's files.  Backup reads from the file
  200.  * /etc/backup_dates to get the days and times that a filesystem
  201.  * should be backed up.  The format of backup_dates is:
  202.  *
  203.  * Day_of_week    Week_of_month    Month    Level    Filesystem    Message
  204.  *
  205.  * where:
  206.  *    Day_of_week is one of {Mon,Tue,Wed,Thu,Fri,Sat,Sun}
  207.  *    Week_of_month is 1-5
  208.  *    Month is one of {Jan,Feb,...,Dec}
  209.  *    Level is 0-9
  210.  *    Filesystem is the NAME of the filesystem
  211.  *    Message is a message to be printed to the operator upon
  212.  *            completion of the dump
  213.  *
  214.  * For example, backup_dates might look like:
  215.  *
  216.  * # Backup schedule for Genie - Genentech, Inc.
  217.  * # Daily level 9's
  218.  * Tue-Fri    *    *    9    /va    "/va dump complete"
  219.  * # Monday dumps - level 1's
  220.  * Mon    2-5    *    1    /    "root dump complete"
  221.  * Mon    2,3,4,5    *    1    /va    "/va dump complete"
  222.  * # Monthly level 0's
  223.  * Mon    1    *    0    /    "root dump complete"
  224.  * Mon    1    *    0    /va    "/va dump complete"
  225.  *
  226.  * Note that the "#" character is used as a comment, and that ranges
  227.  * as well as the "*" may be used.  Obviously ranges and wildcards are
  228.  * only allowed in the Day_of_week and Week_of_month fields.
  229.  *
  230.  * Usage:
  231.  *    backup [-b blocksize] [-s tapelength] [-t device] [-f file ] [-m] [-w n]
  232.  *             [-d density] [date]
  233.  *
  234.  * Diagnostics:
  235.  *    Backup will complain if the input file is garbaged or if the
  236.  *    filesystem is mounted.  The return status from dump is monitored
  237.  *    to track the progress of the dump and to determine if dump
  238.  *    fails.  If it fails, the operator will be prompted to determine
  239.  *    if they want to retry this filesystem.
  240.  *
  241.  * Author: Scooter Morris, Genentech
  242.  * Date: March, 1985
  243.  *
  244.  */
  245.  
  246. #include <stdio.h>
  247. #include <sys/time.h>
  248. #include <fstab.h>
  249. #include <signal.h>
  250. #include <errno.h>
  251. #include <sys/reboot.h>
  252. #include "backup.h"
  253.  
  254. struct tm    *localtime();
  255. struct tm    *convdate();
  256. struct fstab    *fsent;
  257. char         line[180];
  258. extern int    errno;
  259. int        x_opt = NO;
  260.  
  261. char        *day_names[7] =
  262. { "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
  263.  
  264. char        *month_names[12] =
  265. { "January","February","March","April","May","June","July","August",
  266.   "September","October","November","December" };
  267.  
  268. main(argc, argv)
  269. int argc; char *argv[];
  270. {
  271.     FILE    *file;
  272.     char    *ptr;
  273.     char    fname[BUFSIZ];    /* file name */
  274.     char    tname[BUFSIZ];    /* tape name */
  275.     char    fsname[BUFSIZ];
  276.     char    dump_comm[BUFSIZ];
  277.     char    *tmp,*rindex();
  278.     int    f_opt = NO;
  279.     int    t_opt = NO;
  280.     int    m_opt = NO;
  281.     int    date_opt = 0;
  282.     int    ret = 0;
  283.     int    minutes = 5;
  284.     int    tape_block = BLOCK_SIZE;
  285.     int    tape_size = TAPE_LENGTH;
  286.     int    tape_density = TAPE_DENSITY;
  287.     long    tmptime;    /* place to put time */
  288.     struct    tm *curtim;    /* current time structure */
  289.  
  290.     int    week_day,month_week,month,day,year;
  291.  
  292.     argc--, argv++;
  293.     while (argc > 0) {
  294.         ptr = *argv;
  295.         while (*ptr) switch (*ptr++) {
  296.  
  297.         case '-':
  298.             break;
  299.  
  300.         case 'm':
  301.         case 'M':
  302.             m_opt = YES;
  303.             break;
  304.  
  305.         case 'f':
  306.         case 'F':
  307.             f_opt = YES;
  308.             if (*ptr == 0) {
  309.                 argv++;
  310.                 argc--;
  311.                 if (*argv == 0) {
  312.                 fprintf(stderr,
  313.                     "backup: no file given with '-f'.\n");
  314.                 exit(1);
  315.                 }
  316.                 strcpy(fname,*argv);
  317.             }
  318.             else {
  319.                 strcpy(fname,ptr);
  320.                 *ptr = 0;
  321.             }
  322.             break;
  323.  
  324.         case 't':
  325.         case 'T':
  326.             t_opt = YES;
  327.             if (*ptr == 0) {
  328.                 argv++;
  329.                 argc--;
  330.                 if (*argv == 0) {
  331.                 fprintf(stderr,
  332.                     "backup: no device given with '-t'.\n");
  333.                 exit(1);
  334.                 }
  335.                 strcpy(tname,*argv);
  336.             }
  337.             else {
  338.                 strcpy(fname,ptr);
  339.                 *ptr = 0;
  340.             }
  341.             break;
  342.  
  343.         case 'b':
  344.         case 'B':
  345.             if (*ptr == 0) {
  346.                 argv++;
  347.                 argc--;
  348.                 if (*argv == 0) {
  349.                 fprintf(stderr,
  350.             "backup: no blocking factor given with '-b'.\n");
  351.                 exit(1);
  352.                 }
  353.                 tape_block = atoi(*argv);
  354.             }
  355.             else {
  356.                 tape_block = atoi(ptr);
  357.                 *ptr = 0;
  358.             }
  359.             break;
  360.             
  361.  
  362.         case 'd':
  363.         case 'D':
  364.             if (*ptr == 0) {
  365.                 argv++;
  366.                 argc--;
  367.                 if (*argv == 0) {
  368.                 fprintf(stderr,
  369.             "backup: no density given with '-d'.\n");
  370.                 exit(1);
  371.                 }
  372.                 tape_density = atoi(*argv);
  373.             }
  374.             else {
  375.                 tape_density = atoi(ptr);
  376.                 *ptr = 0;
  377.             }
  378.             break;
  379.  
  380.         case 's':
  381.         case 'S':
  382.             if (*ptr == 0) {
  383.                 argv++;
  384.                 argc--;
  385.                 if (*argv == 0) {
  386.                 fprintf(stderr,
  387.                     "backup: no size given with '-s'.\n");
  388.                 exit(1);
  389.                 }
  390.                 tape_size = atoi(*argv);
  391.             }
  392.             else {
  393.                 tape_size = atoi(ptr);
  394.                 *ptr = 0;
  395.             }
  396.             break;
  397.         case 'w':
  398.         case 'W':
  399.             if (*ptr == 0) {
  400.                 argv++;
  401.                 argc--;
  402.                 if (*argv == 0) {
  403.                 fprintf(stderr,
  404.             "backup: warning time in minutes not given with '-w'.\n");
  405.                 exit(1);
  406.                 }
  407.                 minutes = atoi(*argv);
  408.             }
  409.             else {
  410.                 minutes = atoi(ptr);
  411.                 *ptr = 0;
  412.             }
  413.             break;
  414.         case 'X':
  415.         case 'x':
  416.             x_opt = YES;
  417.             printf("*** Debugging ***\n");
  418.             break;
  419.  
  420.         case '0':
  421.         case '1':
  422.         case '2':
  423.         case '3':
  424.         case '4':
  425.         case '5':
  426.         case '6':
  427.         case '7':
  428.         case '8':
  429.         case '9':
  430.             month = day = year = 0;
  431.             date_opt = sscanf(--ptr,"%d/%d/%d",&month,&day,&year);
  432.             if (date_opt < 2)
  433.             {
  434.                 fprintf(stderr,
  435.                 "backup: illegal date specification\n");
  436.                 exit(1);
  437.             }
  438.             *ptr = 0;
  439.             break;
  440.  
  441.         default:
  442.             fprintf(stderr,
  443.             "Unknown option '%c' - ignored\n",ptr[-1]);
  444.         }
  445.         argc--, argv++;
  446.         *ptr = 0;
  447.     }
  448.  
  449.     quiet = 0;
  450.  
  451.     /* Ignore impatience */
  452.  
  453.     signal(SIGTERM,SIG_IGN);
  454.     signal(SIGHUP,SIG_IGN);
  455.     signal(SIGQUIT,SIG_IGN);
  456.     signal(SIGTSTP,SIG_IGN);
  457.  
  458.     /* get current date */
  459.  
  460.     if (date_opt)
  461.     {
  462.         curtim = convdate(month,day,year);
  463.     } else {
  464.         time(&tmptime);
  465.         curtim = localtime(&tmptime);
  466.     }
  467.  
  468.     week_day = curtim -> tm_wday;
  469.     month_week = ( (curtim -> tm_mday - 1) / 7 ) + 1;
  470.     month = curtim -> tm_mon;
  471.  
  472.     /* get dates file name */
  473.  
  474.     if (! f_opt) sprintf(fname,"%s",BACKUPFILE);
  475.     if (! t_opt) sprintf(tname,"%s",DEVICE);
  476.  
  477. /*
  478.  * Open up the input file
  479.  */
  480.  
  481.     file = fopen(fname,"r");
  482.     if (file == NULL)
  483.     {
  484.         perror(file);
  485.         exit(errno);
  486.     }
  487.  
  488. /*
  489.  * Give introduction
  490.  */
  491.  
  492.     printf("backup: Performing backup for %s %s %d, %d\n",
  493.         day_names[week_day],month_names[month],curtim->tm_mday,
  494.         curtim->tm_year+1900);
  495.  
  496.     line_count = 0;
  497.     while (fgets(line,180,file) != NULL)
  498.     {
  499.         line_count++;
  500.         lineptr = 0;
  501.         if(yyparse() || ignore == YES)continue;
  502.  
  503.         if (x_opt)
  504.         {
  505.             printf("Today: %dw %dd %dm\n",month_week,week_day,month);
  506.             printres("Weeks: ",weeks,week_lst,week_ptr);
  507.             printres("Days: ",days,day_lst,day_ptr);
  508.             printres("Months: ",months,month_lst,month_ptr);
  509.         }
  510.  
  511.         if (check_per(month_week,weeks,week_lst,week_ptr))continue;
  512.  
  513.         if (check_per(week_day,days,day_lst,day_ptr))continue;
  514.  
  515.         if (check_per(month,months,month_lst,month_ptr))continue;
  516.  
  517.         fsent = getfsfile(filesys);
  518.         if (fsent == NULL)
  519.         {
  520.             fprintf(stderr,"*** No filesystem %s\n",filesys);
  521.             continue;
  522.         }
  523.  
  524.         if (m_opt == NO)
  525.         {
  526.         /*
  527.          * Single user - if we already haven't quietize the system
  528.          */
  529.  
  530.             if (!quiet) 
  531.             {
  532.                 fprintf(stderr,"%s\n%s",
  533.     "*** You are about ready to kick off all users!!! ***",
  534.     "*** Are you SURE you want to do this? ");
  535.                 gets(dump_comm);
  536.                 if (dump_comm[0] != 'y' &&
  537.                     dump_comm[0] != 'Y') abort();
  538.                 fprintf(stderr,
  539.     "*** Are you POSITIVE??? ");
  540.                 gets(dump_comm);
  541.                 if (dump_comm[0] != 'y' &&
  542.                     dump_comm[0] != 'Y') abort();
  543.  
  544.                 fprintf(stderr,
  545.     "*** Beginning system shutdown....");
  546.                 quietize(minutes);
  547.                 quiet++;
  548.             }
  549.         }
  550.  
  551.         tmp = rindex(fsent->fs_spec,'/');
  552.         fsname[0] = '\0';
  553.         strncpy(fsname,fsent->fs_spec,(int)tmp-(int)(fsent->fs_spec)+1);
  554.         fsname[(int)tmp-(int)(fsent->fs_spec)+1] = '\0';
  555.         strncat(fsname,"r",1);
  556.         strcat(fsname,++tmp);
  557.  
  558.         printf("To perform level %d dump of %s\n",level,filesys);
  559.         dump_comm[0] = '0';
  560. retry:        while (*dump_comm != 'r' && *dump_comm != 'q')
  561.         {
  562. printf("mount first tape and press 'r' RETURN when ready: ");
  563.             gets(dump_comm);
  564.         }
  565.  
  566.         if (*dump_comm == 'q') continue;
  567.  
  568.         sprintf(dump_comm,"%s %1dnufsdb %s %d %d %d %s\n",
  569.                    DUMPCOM,level,tname,
  570.                    tape_size,tape_density,tape_block,
  571.                    fsname);
  572.  
  573.         ret = system(dump_comm);
  574.  
  575.         sprintf(line,"mt -t %s offl\n",tname);
  576.         system(line);
  577.         printf("*** %s ***\n",string);
  578.     }
  579.  
  580.     printf("Backup is now complete!\n");
  581.     if (m_opt == NO)
  582.     {
  583.         restart();    /* Restart the System */
  584.     }
  585. }
  586.  
  587. char
  588. getnextchar()
  589. {
  590.     return((char)line[lineptr++]);
  591. }
  592.  
  593. check_per(today,target,list,count)
  594. int today,target,count;
  595. int list[];
  596. {
  597.     int i;
  598.  
  599.     if (target == ALL)
  600.         return(0);
  601.     else if (target == LIST)
  602.     {
  603.         for (i = 0 ; i < count ; i++)
  604.         {
  605.             if(list[i] == today)return(0);
  606.         }
  607.     }
  608.     else if (target == RANGE && today >= list[0] && today <= list[1])
  609.         return(0);
  610.  
  611.     return(1);
  612. }
  613.  
  614. printres(string,today,list,count)
  615. char    *string;
  616. int    today;
  617. int    list[];
  618. int    count;
  619. {
  620.     int i;
  621.  
  622.     printf("%s ",string);
  623.     switch(today)
  624.     {
  625.     case ALL:
  626.         printf("ALL ");
  627.         break;
  628.     case LIST:
  629.         printf("LIST ");
  630.         break;
  631.     case RANGE:
  632.         printf("RANGE ");
  633.         break;
  634.     }
  635.  
  636.     printf("(%d)",count);
  637.     for (i = 0 ; i < count ; i++)
  638.     {
  639.         printf(" %d,",list[i]);
  640.     }
  641.     printf("\n");
  642. }
  643.  
  644. abort()
  645. {
  646.     fprintf(stderr,"*** Backup aborted ***\n");
  647.     exit(1);
  648. }
  649. SHAR_EOF
  650. fi # end of overwriting check
  651. if test -f 'backup.h'
  652. then
  653.     echo shar: will not over-write existing file "'backup.h'"
  654. else
  655. cat << \SHAR_EOF > 'backup.h'
  656. /* $Header: backup.h,v 1.3 86/10/14 01:36:46 scooter Exp $ */
  657. /*
  658.  * backup.h - defines and defaults for backup
  659.  */
  660.  
  661. #define    BLOCK_SIZE    32    /* Default blocking factor */
  662. #define    TAPE_LENGTH    2300    /* Default tape length */
  663. #define TAPE_DENSITY    6250    /* Default tape density */
  664. #define DEVICE    "/dev/rmt9"    /* Default device for dumps */
  665. #define    BACKUPFILE "/etc/backup_dates"
  666. #define DUMPCOM "/etc/dump"
  667.  
  668. #define    YES    1
  669. #define    NO    0
  670. #define    ALL    -1
  671. #define    RANGE    0
  672. #define    LIST    1
  673.  
  674. int    ignore,days,weeks,months;
  675. int    week_ptr,week_lst[5];
  676. int    month_ptr,month_lst[12];
  677. int    day_ptr,day_lst[7];
  678. int    level,line_count,lineptr;
  679. char    string[180];
  680. char    filesys[180];
  681. int    quiet;
  682. extern    int    x_opt;
  683. SHAR_EOF
  684. fi # end of overwriting check
  685. if test -f 'convdate.c'
  686. then
  687.     echo shar: will not over-write existing file "'convdate.c'"
  688. else
  689. cat << \SHAR_EOF > 'convdate.c'
  690. #ifndef lint
  691.     static char RCSid[] = "$Header: convdate.c,v 1.1 85/05/22 15:53:36 scooter Exp $";
  692. #endif lint
  693.  
  694. /*
  695.  * Module to convert date from mm/dd/yy format to a "tm" structure
  696.  */
  697.  
  698.  
  699. #include    <stdio.h>
  700. #include    <sys/time.h>
  701. #include    <tzfile.h>
  702.  
  703. static int    dmsize[13] =
  704.     { -1,31,28,31,30,31,30,31,31,30,31,30,31 };
  705.  
  706. struct tm *
  707. convdate(month,day,year)
  708. int month,day,year;
  709. {
  710.     int i;
  711.     struct tm *today;
  712.     struct timeval tv;
  713.     struct timezone tz;
  714.  
  715.     gettimeofday(&tv,&tz);
  716.     today = localtime(&tv.tv_sec);
  717.  
  718.     if (year == 0)year = today->tm_year;
  719.     if (month == 0)month = today->tm_mon+1;
  720.     if (day == 0)day = today->tm_mday;
  721.  
  722.     if (year < 1000)year += 1900;
  723.  
  724.     tv.tv_sec = 0;
  725.  
  726.     if (isleap(year) && month > 2)
  727.         ++tv.tv_sec;
  728.     for (--year;year >= EPOCH_YEAR;--year)
  729.         tv.tv_sec += isleap(year) ? DAYS_PER_LYEAR : DAYS_PER_NYEAR;
  730.     while (--month)
  731.         tv.tv_sec += dmsize[month];
  732.     tv.tv_sec += day - 1;
  733.     tv.tv_sec = HOURS_PER_DAY * tv.tv_sec;
  734.     tv.tv_sec = MINS_PER_HOUR * tv.tv_sec;
  735.     tv.tv_sec = SECS_PER_MIN * tv.tv_sec;
  736.     
  737.     /* Now convert to local timezone */
  738.     tv.tv_sec += (long)tz.tz_minuteswest*SECS_PER_MIN;
  739.     if (localtime(&tv.tv_sec)->tm_isdst) tv.tv_sec -= SECS_PER_HOUR;
  740.  
  741.     return(localtime(&tv.tv_sec));
  742. }
  743. SHAR_EOF
  744. fi # end of overwriting check
  745. if test -f 'parser.y'
  746. then
  747.     echo shar: will not over-write existing file "'parser.y'"
  748. else
  749. cat << \SHAR_EOF > 'parser.y'
  750. %{
  751. static char rcsid[] = "$Header: parser.y,v 1.2 85/04/05 17:15:02 scooter Exp $";
  752.  
  753. #include    "backup.h"
  754.  
  755. %}
  756.  
  757. %start pgm
  758.  
  759. %token COMMENT DAY STRING NUM FILESYS STAR DASH NEWLINE MONTH COMMA
  760.  
  761. %%
  762.  
  763. pgm    : COMMENT NEWLINE
  764.                 { ignore = YES; YYACCEPT; }
  765.     | day_spec week_spec month_spec level filesys end_spec NEWLINE
  766.                 { ignore = NO; YYACCEPT; }
  767.     | error '\n'
  768.                 { yyerrok; }
  769.     ;
  770.  
  771. level:    NUM
  772.                 { level = $1; }
  773.     ;
  774.  
  775. filesys: FILESYS
  776.                 { strcpy(filesys,yytext); }
  777.     ;
  778.  
  779. day_spec: STAR
  780.                 { days = ALL; }
  781.     | day_list
  782.                 { days = LIST; }
  783.     | DAY DASH DAY
  784.                 { days = RANGE; day_lst[0] = $1; 
  785.                   day_lst[1] = $3; day_ptr = 2;}
  786.     ;
  787.  
  788. day_list: DAY
  789.                 { day_ptr = 0; day_lst[day_ptr++] = $1; }
  790.     | day_list COMMA DAY
  791.                 { day_lst[day_ptr++] = $3; }
  792.     ;
  793.  
  794. week_spec:STAR
  795.                 { weeks = ALL; }
  796.     | num_list
  797.                 { weeks = LIST; }
  798.     | NUM DASH NUM
  799.                 { weeks = RANGE; week_lst[0] = $1; 
  800.                   week_lst[1] = $3; week_ptr = 2;}
  801.     ;
  802.  
  803. num_list: NUM
  804.                 { week_ptr = 0; week_lst[week_ptr++] = $1; }
  805.     | num_list COMMA NUM
  806.                 { week_lst[week_ptr++] = $3; }
  807.     ;
  808.  
  809. month_spec: STAR
  810.                 { months = ALL; }
  811.     | month_list
  812.                 { months = LIST; }
  813.     | MONTH DASH MONTH
  814.                 { months = RANGE; month_lst[0] = $1; 
  815.                   month_lst[1] = $3; month_ptr = 2;}
  816.     ;
  817.  
  818. month_list: MONTH
  819.                 { month_ptr = 0; month_lst[month_ptr++] = $1; }
  820.     | month_list COMMA MONTH
  821.                 { month_lst[month_ptr++] = $3; }
  822.     ;
  823.  
  824. end_spec:    /* empty */
  825.     | STRING
  826.     | STRING COMMENT
  827.     | COMMENT
  828.     ;
  829.  
  830. %%
  831.  
  832. #include "lex.yy.c"
  833.  
  834. yyerror(s)
  835. char *s;
  836. {
  837.     fprintf(stderr,"%s:line = %d, char = %d\n",s,line_count,lineptr);
  838. }
  839. SHAR_EOF
  840. fi # end of overwriting check
  841. if test -f 'proclist.c'
  842. then
  843.     echo shar: will not over-write existing file "'proclist.c'"
  844. else
  845. cat << \SHAR_EOF > 'proclist.c'
  846. static char rcsid[] = "$Header: proclist.c,v 1.6 87/05/25 16:55:54 scooter Exp $";
  847.  
  848. /*
  849.  * proclist
  850.  *
  851.  * This routine returns a list of candidate procedures for
  852.  * killing.
  853.  *
  854.  * $Log:    proclist.c,v $
  855.  * Revision 1.6  87/05/25  16:55:54  scooter
  856.  * Added Appleshare stuff to "special processing" list
  857.  * 
  858.  * Revision 1.5  86/10/15  09:26:13  scooter
  859.  * Added syslogd to the exclusion list
  860.  * 
  861.  * Revision 1.4  86/10/14  01:33:46  scooter
  862.  * Added process specific startup/shutdown stuff
  863.  * 
  864.  *
  865.  */
  866.  
  867. #include "backup.h"
  868. #include "ulist.h"
  869. #include <stdio.h>
  870.  
  871. /*
  872.  * Table of offsets for portions of the ps -l line
  873.  */
  874.  
  875. #define    UID    7
  876. #define    PID    12
  877. #define    PPID    18
  878. #define    STAT    61
  879. #define    CMD    75
  880.  
  881. /*
  882.  * List of processes to exclude
  883.  */
  884.  
  885. char    *exlist[] =
  886.     { "init",
  887.       "swapper",
  888.       "pagedaemon",
  889.       "/etc/timed",
  890.       "/etc/named",
  891.       "/etc/syslogd",
  892.       "/etc/atalkad",        /* Kinetics route info server */
  893.       "/usr/local/lib/lsrv",    /* Appletalk spooler */
  894.       "/usr/local/lib/atis",    /* Appletalk name server */
  895.       "- std.9600",
  896.       "- std.4800",
  897.       "- std.1200",
  898.       "- P4800",
  899.       "- P1200",
  900.       "- D1200",
  901.       "- Console",
  902.       0 };
  903.  
  904. /*
  905.  * Processes which require special shutdown/restart
  906.  */
  907.  
  908. struct    proc_struct 
  909. {
  910.     char    *pr_name;
  911.     char    *pr_shutdown;
  912.     char    *pr_restart;
  913. } special_procs[] = {
  914.     {"/etc/rjecop","opr 0 .d","/etc/hsp_reload"},
  915.     {"genie Aufs Daemon","kill -TERM %d","cd /usr/adm;/usr/local/lib/aufs -V AppleSharePublicVolumes -U 20"},
  916.     {"jinn Aufs Daemon","kill -TERM %d","cd /usr/adm;/usr/local/lib/aufs -U 20"},
  917.     {0,0,0}
  918. };
  919.  
  920. struct ulist *
  921. proclist()
  922. {
  923.     struct ulist *head=NULL;
  924.     struct ulist *tail=NULL;
  925.     FILE *pschan,*popen();
  926.     char string[180],*tmp,*rindex();
  927.     int i,ex_flag;
  928.  
  929.     pschan = popen("/bin/ps -lgaxw","r");
  930.     if (pschan == NULL)
  931.     {
  932.         fprintf(stderr,"*** Unable to get ps listing ***");
  933.         exit (1);
  934.     }
  935.  
  936.     fgets(string,180,pschan);    /* Skip the header */
  937.  
  938.     while ( fgets(string,180,pschan) != NULL )
  939.     {
  940.  
  941.         /*
  942.          * Check for excluded processes
  943.          */
  944.  
  945.         i = ex_flag = 0;
  946.  
  947.         while ( tmp = exlist[i++] )
  948.         {
  949.             if (!strncmp(string+CMD,tmp,strlen(tmp)))
  950.             {
  951.                 ex_flag = 1;
  952.                 break;
  953.             }
  954.         }
  955.  
  956.         if (ex_flag) continue;
  957.  
  958.         if (head == NULL)
  959.         {
  960.             head = tail = (struct ulist *)
  961.                 malloc(sizeof(struct ulist));
  962.         } else
  963.         {
  964.             tail->next = (struct ulist *)
  965.                 malloc(sizeof(struct ulist));
  966.             tail = tail->next;
  967.         }
  968.  
  969.         tail->uid = atoi(string+UID);
  970.         tail->pid = atoi(string+PID);
  971.         tail->ppid = atoi(string+PPID);
  972.         strncpy(tail->stat,string+STAT,4);
  973.         strncpy(tail->cmd,string+CMD,39);
  974.         tmp = rindex(tail->cmd,'\n');
  975.         if (tmp != NULL)*tmp = '\0';
  976.         tail->special_flag = 0;
  977.         tail->next = NULL;
  978.  
  979.         /*
  980.          * Check for special shutdown/startup
  981.          */
  982.         
  983.         i = 0;
  984.         while ( tmp = special_procs[i].pr_name )
  985.         {
  986.             if (!strncmp(tail->cmd,tmp,strlen(tmp)))
  987.             {
  988.                 tail->special_flag++;
  989.                 
  990.                 /* Allow single argument (pid) -- this will allow special signals */
  991.                 sprintf(tail->proc_shutdn, special_procs[i].pr_shutdown, tail->pid);
  992.                 sprintf(tail->proc_restart, special_procs[i].pr_restart, tail->pid);
  993.                 break;
  994.             }
  995.             i++;
  996.         }
  997.  
  998.  
  999. #ifdef    DEBUG
  1000.         if (x_opt)
  1001.             printf("%6d, %6d, %6d, %4s, %s\n",tail->uid,tail->pid,
  1002.                     tail->ppid,tail->stat,tail->cmd);
  1003. #endif    DEBUG
  1004.  
  1005.     }
  1006.     pclose(pschan);
  1007.  
  1008.     return(head);
  1009. }
  1010. SHAR_EOF
  1011. fi # end of overwriting check
  1012. if test -f 'quietize.c'
  1013. then
  1014.     echo shar: will not over-write existing file "'quietize.c'"
  1015. else
  1016. cat << \SHAR_EOF > 'quietize.c'
  1017. static char rcsid[] = "$Header: quietize.c,v 1.7 86/10/14 01:34:03 scooter Exp $";
  1018.  
  1019. /*
  1020.  * quietize
  1021.  *
  1022.  * This module controls all of the procedures necessary to bring
  1023.  * the system to a quiescent state.  Basically this can be summarized
  1024.  * by the following:
  1025.  *
  1026.  *    1. Do a shutdown to tell the users goodbye (/etc/shutdown)
  1027.  *    2. Get a listing of all the processes running (/bin/ps)
  1028.  *    3. Send a SIGHUP to all user processes and handle special shutdown
  1029.  *    4. Get another listing
  1030.  *    5. Send a SIGSTOP to everything but gettys and inits
  1031.  *
  1032.  * $Log:    quietize.c,v $
  1033.  * Revision 1.7  86/10/14  01:34:03  scooter
  1034.  * Added process specific startup/shutdown stuff
  1035.  * 
  1036.  *
  1037.  */
  1038.  
  1039. #include    "backup.h"
  1040. #include    "ulist.h"
  1041. #include    <stdio.h>
  1042. #include    <signal.h>
  1043.  
  1044. struct    ulist     *u_list,*proclist(),*proc;
  1045. int    our_pid;
  1046. int    our_ppid;
  1047.  
  1048. quietize(minutes)
  1049. int minutes;
  1050. {
  1051.     int fixlog(),procont();
  1052.  
  1053. /*
  1054.  * Begin by going through all of the warning stuff
  1055.  */
  1056.  
  1057.     fprintf(stderr,"\n*** Warning users ...");
  1058.     if (minutes <= 0)minutes = 5;
  1059.  
  1060.     signal(SIGINT,fixlog);
  1061.  
  1062. #ifdef    DEBUG
  1063.     if (x_opt == NO)
  1064.         shutdown(minutes);
  1065. #else    DEBUG
  1066.     shutdown(minutes);
  1067. #endif    DEBUG
  1068.  
  1069. /*
  1070.  * Get our pid
  1071.  */
  1072.  
  1073.     our_pid = getpid();
  1074.  
  1075. /*
  1076.  * Get the list of processes on the system
  1077.  */
  1078.  
  1079.     fprintf(stderr,"\n*** Finding processes ...");
  1080.     u_list = proclist();
  1081.  
  1082. /*
  1083.  * Blow them away
  1084.  */
  1085.  
  1086.     fprintf(stderr,"\n*** Hanging up processes ...");
  1087.     for (proc = u_list ; proc != NULL ; proc = proc->next)
  1088.     {
  1089.         if (proc->pid == our_pid)our_ppid = proc->ppid;
  1090.     }
  1091.  
  1092. #ifdef    DEBUG
  1093.     if (x_opt)
  1094.         printf("Our pid = %d, our ppid = %d\n",our_pid,our_ppid);
  1095. #endif    DEBUG
  1096.  
  1097.     for (proc = u_list ; proc != NULL ; proc = proc->next)
  1098.     {
  1099.         if (proc->pid == our_pid ||
  1100.             proc->pid == our_ppid ||
  1101.             proc->special_flag)continue;
  1102. #ifdef    DEBUG
  1103.     if (x_opt)
  1104.         printf("Hanging up proces %s (%d)\n",proc->cmd,proc->pid);
  1105.     else
  1106. #endif    DEBUG
  1107.         kill(proc->pid,SIGHUP);
  1108.     }
  1109.  
  1110.     /*
  1111.      * Make an attempt to be clean by freeing up the memory
  1112.      */
  1113.  
  1114.     for (proc = u_list ; proc != NULL ; )
  1115.     {
  1116.         free(proc->cmd);
  1117.         u_list = proc;
  1118.         proc = proc->next;
  1119.         free(u_list);
  1120.     }
  1121.  
  1122.     /*
  1123.      * Get the left-over list
  1124.      */
  1125.  
  1126.     u_list = proclist();
  1127.  
  1128.     /*
  1129.      * Stop them
  1130.      */
  1131.  
  1132.     fprintf(stderr,"\n*** Stopping up processes ...");
  1133.  
  1134.     signal(SIGINT,procont);
  1135.  
  1136.     for (proc = u_list ; proc != NULL ; proc = proc->next)
  1137.     {
  1138.         if ( proc->pid == our_pid ||
  1139.             proc->pid == our_ppid)continue;
  1140.  
  1141. #ifdef    DEBUG
  1142.         if (x_opt)
  1143.         {
  1144.             if (proc->special_flag)
  1145.                 printf("Special shutdown of %s (%d) with %s\n",
  1146.                     proc->cmd,proc->pid,proc->proc_shutdn);
  1147.             else
  1148.                 printf("Stopping up process %s (%d)\n",proc->cmd,
  1149.                     proc->pid);
  1150.         } else
  1151. #endif    DEBUG
  1152.         if (proc->special_flag)
  1153.             system(proc->proc_shutdn);
  1154.         else
  1155.             kill(proc->pid,SIGSTOP);
  1156.     }
  1157.  
  1158.     /*
  1159.      * Now that things should be quiet, sync the disks
  1160.      */
  1161.  
  1162.     sync();
  1163.     sleep(1);
  1164.     sync();
  1165.     sleep(5);
  1166.  
  1167. }
  1168.  
  1169. fixlog()
  1170. {
  1171.     unlink("/etc/nologin");
  1172.     fprintf(stderr,"*** Backup aborted ***\n");
  1173.     exit(0);
  1174. }
  1175.  
  1176. procont()
  1177. {
  1178.     int restart();
  1179.  
  1180.     restart();
  1181.     fprintf(stderr,"*** Backup aborted ***\n");
  1182.     exit(0);
  1183. }
  1184. SHAR_EOF
  1185. fi # end of overwriting check
  1186. if test -f 'restart.c'
  1187. then
  1188.     echo shar: will not over-write existing file "'restart.c'"
  1189. else
  1190. cat << \SHAR_EOF > 'restart.c'
  1191. static char rcsid[] = "$Header: restart.c,v 1.3 86/10/14 01:34:06 scooter Exp $";
  1192.  
  1193. /*
  1194.  * restart
  1195.  *
  1196.  * This module controls the system restart after backup is complete
  1197.  *
  1198.  * $Log:    restart.c,v $
  1199.  * Revision 1.3  86/10/14  01:34:06  scooter
  1200.  * Added process specific startup/shutdown stuff
  1201.  * 
  1202.  *
  1203.  */
  1204.  
  1205. #include    <stdio.h>
  1206. #include    "backup.h"
  1207. #include    "ulist.h"
  1208. #include    <signal.h>
  1209.  
  1210. extern struct ulist    *u_list;
  1211. extern int        our_pid,our_ppid;
  1212.  
  1213. restart()
  1214. {
  1215.     FILE *fs;
  1216.     struct ulist *proc;
  1217.     
  1218.  
  1219.     /*
  1220.      * Restart stopped processes
  1221.      */
  1222.  
  1223.     fprintf(stderr,"\n*** Restarting processes ...");
  1224.  
  1225.     for (proc = u_list ; proc != NULL ; proc = proc->next)
  1226.     {
  1227.         if (proc->pid < 5 || proc->pid == our_pid ||
  1228.             proc->pid == our_ppid)continue;
  1229.  
  1230. #ifdef    DEBUG
  1231.         if (x_opt)
  1232.             if (proc->special_flag)
  1233.                 printf("restarting %s with %s\n",
  1234.                     proc->cmd,proc->proc_restart);
  1235.             else
  1236.                 printf("starting process %d\n",proc->pid);
  1237.         else
  1238. #endif    DEBUG
  1239.         if (proc->special_flag)
  1240.             system(proc->proc_restart);
  1241.         else
  1242.             kill(proc->pid,SIGCONT);
  1243.     }
  1244.  
  1245.     unlink("/etc/nologin");        /* Make sure users can log in */
  1246.  
  1247.     unlink("/dev/printer");        /* Restart all of the printers */
  1248.     system("/usr/lib/lpd");        /* Start the deaemon */
  1249.  
  1250.     return(0);
  1251. }
  1252. SHAR_EOF
  1253. fi # end of overwriting check
  1254. if test -f 'scanner.l'
  1255. then
  1256.     echo shar: will not over-write existing file "'scanner.l'"
  1257. else
  1258. cat << \SHAR_EOF > 'scanner.l'
  1259. %{
  1260. /* $Header: scanner.l,v 1.3 85/04/08 09:59:35 scooter Exp $ */
  1261.  
  1262. #include    "y.tab.h"
  1263.  
  1264. #undef  input
  1265. #undef  output
  1266. #undef  unput
  1267. #define allprint(c) (putchar(c))
  1268. #define sprint(str) (printf("%s",str))
  1269. #define output(c) (putchar(c))
  1270. #define input() (yytchar=yysptr>yysbuf?U(*--yysptr):getnextchar())
  1271. #define unput(c) (*yysptr++=(c))
  1272. #define yywrap() 1
  1273.  
  1274. %}
  1275.  
  1276. star    \*
  1277. dash    \-
  1278. filesys    \/[0-9a-zA-Z/]*
  1279. slash    \/
  1280. space    [ \t] 
  1281. nu    [0-9][0-9]*
  1282. arb    [a-zA-Z]*
  1283. string    \"[^"]*\"
  1284. comm    \#.*
  1285. quote    \"
  1286. comma    \,
  1287. newline [\n]
  1288. a    [aA]
  1289. b    [bB]
  1290. c    [cC]
  1291. d    [dD]
  1292. e    [eE]
  1293. f    [fF]
  1294. g    [gG]
  1295. h    [hH]
  1296. i    [iI]
  1297. j    [jJ]
  1298. k    [kK]
  1299. l    [lL]
  1300. m    [mM]
  1301. n    [nN]
  1302. o    [oO]
  1303. p    [pP]
  1304. q    [qQ]
  1305. r    [rR]
  1306. s    [sS]
  1307. t    [tT]
  1308. u    [uU]
  1309. v    [vV]
  1310. w    [wW]
  1311. x    [xX]
  1312. y    [yY]
  1313. z    [zZ]
  1314.  
  1315. %%
  1316.  
  1317. {comm}{arb}        {return(COMMENT);}
  1318. {string}        {strcpy(string,yytext);return(STRING);}
  1319. {star}{space}        {yylval=0;return(STAR);}
  1320.  
  1321. {nu}            {sscanf(yytext,"%d",&yylval);
  1322.              return(NUM);}
  1323. {dash}            {return(DASH);}
  1324.  
  1325. {s}{u}{n}{arb}        {yylval=0;return(DAY);}
  1326. {m}{o}{n}{arb}        {yylval=1;return(DAY);}
  1327. {t}{u}{e}{arb}        {yylval=2;return(DAY);}
  1328. {w}{e}{d}{arb}        {yylval=3;return(DAY);}
  1329. {t}{h}{u}{arb}        {yylval=4;return(DAY);}
  1330. {f}{r}{i}{arb}        {yylval=5;return(DAY);}
  1331. {s}{a}{t}{arb}        {yylval=6;return(DAY);}
  1332.  
  1333. {j}{a}{n}{arb}        {yylval=0;return(MONTH);}
  1334. {f}{e}{b}{arb}        {yylval=1;return(MONTH);}
  1335. {m}{a}{r}{arb}        {yylval=2;return(MONTH);}
  1336. {a}{p}{r}{arb}        {yylval=3;return(MONTH);}
  1337. {m}{a}{y}{arb}        {yylval=4;return(MONTH);}
  1338. {j}{u}{n}{arb}        {yylval=5;return(MONTH);}
  1339. {j}{u}{l}{arb}        {yylval=6;return(MONTH);}
  1340. {a}{u}{g}{arb}        {yylval=7;return(MONTH);}
  1341. {s}{e}{p}{arb}        {yylval=8;return(MONTH);}
  1342. {o}{c}{t}{arb}        {yylval=9;return(MONTH);}
  1343. {n}{o}{v}{arb}        {yylval=10;return(MONTH);}
  1344. {d}{e}{c}{arb}        {yylval=11;return(MONTH);}
  1345.  
  1346. {filesys}        {return(FILESYS);}
  1347. {newline}        {return(NEWLINE);}
  1348. {comma}            {return(COMMA);}
  1349.  
  1350. [ \t,]    ;
  1351. SHAR_EOF
  1352. fi # end of overwriting check
  1353. if test -f 'shutdown.c'
  1354. then
  1355.     echo shar: will not over-write existing file "'shutdown.c'"
  1356. else
  1357. cat << \SHAR_EOF > 'shutdown.c'
  1358. static char rcsid[] = "$Header: shutdown.c,v 1.1 85/04/05 17:14:09 scooter Exp $";
  1359.  
  1360. /*
  1361.  * shutdown
  1362.  *
  1363.  * This module controls the system shutdown message stuff.
  1364.  */
  1365.  
  1366. #include    <stdio.h>
  1367. #include    "backup.h"
  1368.  
  1369. shutdown(minutes)
  1370. int minutes;
  1371. {
  1372.     char    temp[180];
  1373.     FILE    *nlfl;
  1374.  
  1375. /*
  1376.  * Begin by formatting the shutdown command
  1377.  */
  1378.  
  1379.     sprintf(temp,"/etc/shutdown -k +%d %s",minutes,
  1380.             "System going down for system backups");
  1381.  
  1382.     system (temp);
  1383.  
  1384. /*
  1385.  * Now sleep until shutdown is complete
  1386.  */
  1387.  
  1388.     sleep(minutes*60 + 5);
  1389.  
  1390. /*
  1391.  * Since shutdown unlinks /etc/nologin when it exits, we must re-do it
  1392.  */
  1393.  
  1394.     nlfl = fopen("/etc/nologin","w");
  1395.     if (nlfl == NULL)
  1396.     {
  1397.         fprintf(stderr,"*** Warning: unable to disable logins\n");
  1398.     } else {
  1399.         fprintf(nlfl,"NO LOGINS: System backups in progress\n");
  1400.         fflush(nlfl);
  1401.         fclose(nlfl);
  1402.     }
  1403.  
  1404. }
  1405. SHAR_EOF
  1406. fi # end of overwriting check
  1407. if test -f 'ulist.h'
  1408. then
  1409.     echo shar: will not over-write existing file "'ulist.h'"
  1410. else
  1411. cat << \SHAR_EOF > 'ulist.h'
  1412. /* $Header: ulist.h,v 1.2 86/10/14 01:34:47 scooter Exp $ */
  1413. struct    ulist {
  1414.     int    pid;        /* Process id */
  1415.     int    ppid;        /* Parent process id */
  1416.     int    uid;        /* Uid of the process */
  1417.     int    stat[4];    /* The process state */
  1418.     char    cmd[40];    /* The command name */
  1419.     int    special_flag;    /* Special startup/shutdown? */
  1420.     char    proc_shutdn[80];    /* shutdown command */
  1421.     char    proc_restart[80];    /* restart command */
  1422.     struct    ulist *next;
  1423. };
  1424. SHAR_EOF
  1425. fi # end of overwriting check
  1426. if test -f 'genie_dates'
  1427. then
  1428.     echo shar: will not over-write existing file "'genie_dates'"
  1429. else
  1430. cat << \SHAR_EOF > 'genie_dates'
  1431. # Backup schedule for Genie - Genentech, Inc.
  1432. # Daily level 2's
  1433. Mon-Thu    *    *    2    /va    "Dump complete - Label tape  /va  level 2  Today's date "
  1434. Mon-Thu    *    *    2    /usr/src    "Dump complete - Label tape  /usr/src  level 2  Today's date"
  1435. Mon-Thu    *    *    2    /usr    "Dump complete - Label tape  /usr  level 2  Today's date"
  1436. Mon-Thu    *    *    2    /usr/spool    "Dump complete - Label tape  /usr/spool  level 2  Today's date"
  1437. Mon-Thu    *    *    2    /nmr    "Dump complete - Label tape  /nmr  level 2  Today's date"
  1438. # Weekly level 1's
  1439. Fri    1-5    *    1    /    "Dump complete - Label tape /  level 1  Today's date"
  1440. Fri    1-5    *    1    /va    "Dump complete - Label tape /va  level 1  Today's date"
  1441. Fri    1-5    *    1    /usr/src    "Dump complete - Label tape /usr/src  level 1  Today's date"
  1442. Fri    1-5    *    1    /usr    "Dump complete - Label tape /usr  level 1  Today's date"
  1443. Fri    1-5    *    1    /usr/spool    "Dump complete - Label tape /usr/spool  level 1  Today's date"
  1444. Fri    1-5    *    1    /nmr    "Dump complete - Label tape /nmr  level 1  Today's date"
  1445. Fri    1-5    *    1    /usr/seqdb    "Dump complete - Label tape /usr/seqdb  level 1  Today's date"
  1446. Fri    1-5    *    1    /usr/src/contrib    "Dump complete - Label tape /usr/src/contrib  level 1  Today's date"
  1447. # Monthly level 0's
  1448. Sun    1    *    0    /    "Dump complete - Label tape  root  level 0  Today's date"
  1449. Sun    1    *    0    /va    "Dump complete - Label tapes  /va  level 0  Today's date  Vol #"
  1450. Sun    1    *    0    /usr/src    "Dump complete - Label tape  /usr/src  level 0 Today's date"
  1451. Sun    1    *    0    /usr    "Dump complete - Label tapes  /usr  level 0  Today's date  Vol #"
  1452. Sun    1    *    0    /usr/spool    "Dump complete - Label tape  /usr/spool  level 0  Today's date  Vol #"
  1453. Sun    1    *    0    /nmr    "Dump complete - Label tape  /nmr  level 0  Today's date  Vol #"
  1454. SHAR_EOF
  1455. fi # end of overwriting check
  1456. if test -f 'backup_dates'
  1457. then
  1458.     echo shar: will not over-write existing file "'backup_dates'"
  1459. else
  1460. cat << \SHAR_EOF > 'backup_dates'
  1461. # Backup schedule for Genie - Genentech, Inc.
  1462. # Daily level 9's
  1463. Tue,Fri    *    *    9    /va    "/va dump complete"
  1464. Tue,Wed,Fri    *    *    9    /vb    "/vb dump complete"
  1465. Tue,Wed,Fri    *    *    9    /vc    "/vc dump complete"
  1466. SHAR_EOF
  1467. fi # end of overwriting check
  1468. #    End of shell archive
  1469. exit 0
  1470.